<template>
	<div class="announcement_container">
			<van-cell value="" center @click="goAnnouncementDetail">
				<template #title>
					<div class="font-left fs-lh-1 fc-w">{{ $t('公告') }}</div>
				</template>
				<template #label>
					<div class="font-left announcementLabel">{{ announcementLabel }}</div>
				</template>
				<!-- <template #icon>
					<img class="img-s br-16" src="@/image/homePage/indexList/testImage.png" alt="">
				</template> -->
				<template #default>
					<div class="font-right pr-1">{{ announcementDate }}</div>
				</template>
			</van-cell>
			<van-cell value="" center>
				<template #title>
					<div class="font-left fs-lh-1 fc-w">{{ $t('NFT') }}</div>
				</template>
				<template #label v-if="!!NFTLabel">
					<div class="font-left announcementLabel">{{ NFTLabel }}</div>
				</template>
				<!-- <template #icon>
					<img class="img-s br-16" src="@/image/homePage/indexList/testImage.png" alt="">
				</template> -->
				<template #default v-if="!!NFTDate">
					<div class="font-right pr-1">{{ NFTDate }}</div>
				</template>
			</van-cell>
	</div>
</template>

<script>
import { getAnnounceList } from "@/request/homePage"
export default {
	name: "Announcement",
	components: {
	},
	data(){
		return {
			announcementDate: new Date().toLocaleDateString().replace(/\//g, '-'),
			announcementLabel: '',
			NFTLabel: '',
			NFTDate: new Date().toLocaleDateString().replace(/\//g, '-'),
		}
	},
	mounted(){
		// 请求公告列表数据
		this.getAnnounceList();
	},
	methods:{
		async getAnnounceList() {
			getAnnounceList({}).then((res) => {
				if(res.code == 1){
					this.announcementLabel = res.data.data[0].data || res.data.data[0].zh_cn;
					this.announcementDate = res.data.data[0].createtime;
				}
			})
		},
		goAnnouncementDetail(){
			// 跳转公告详情列表页
			console.log(this.$route.path)
			if (this.$route.name !== 'AnnouncementList') {
				this.$router.push({ 
					name: 'AnnouncementList',
					params: { 
						// 可以传递需要的参数
					}
				})
			}
		}
	}
};
</script>

<style lang="less">
</style>